package com.wangshouyu.mp.message;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @date 2020年12月07日 11:11
 * @description 文章消息
 */
@XStreamAlias(value = "item")
public class ArticleMessage implements Serializable {

    /**
     * 图文消息标题
     */
    @XStreamAlias(value = "Title")
    private String title;

    /**
     * 图文消息描述
     */
    @XStreamAlias(value = "Description")
    private String description;

    /**
     * 图片链接
     */
    @SerializedName(value = "picurl")
    @JsonProperty(value = "picurl")
    @JSONField(name = "picurl")
    @XStreamAlias(value = "PicUrl")
    private String picUrl;

    /**
     * 点击图文消息跳转链接
     */
    @XStreamAlias(value = "Url")
    private String url;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ArticleMessage that = (ArticleMessage) o;
        return Objects.equals(title, that.title) &&
                Objects.equals(description, that.description) &&
                Objects.equals(picUrl, that.picUrl) &&
                Objects.equals(url, that.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(title, description, picUrl, url);
    }

    @Override
    public String toString() {
        return "ArticleMessage{" +
                "title='" + title + '\'' +
                ", description='" + description + '\'' +
                ", picUrl='" + picUrl + '\'' +
                ", url='" + url + '\'' +
                '}';
    }
}
